#pragma once
class BaseObject;

#include "../SGD Wrappers/SGD_Handle.h"	
#include "../SGD Wrappers/SGD_GraphicsManager.h"
#include <vector>

class ObjectManager;
class Layer;
class Camera;

class TileSystem
{
	

public:

	TileSystem();
	~TileSystem();

	void Render();
	bool Load(std::string FileName, ObjectManager* obj);
	void Save(const char* FileName);
	bool CheckCol(BaseObject* pOther);
	void CreateMap();
	
	int GetStartingX()	const	{ return m_nStartingX;	}
	int GetStartingY()	const	{ return m_nStartingY;	}
	int GetEndingX()	const	{ return m_nEndingX;	}
	int GetEndingY()	const	{ return m_nEndingY;	}
	int GetMapWidth()	const	{ return m_nMapWidth;	}	
	std::vector<Layer*> GetLayerVec() const	{ return m_vLayerVector; }
	void Update();

	std::string GetTileSetPath();
	SGD::Rectangle CellAlgorithm(int id) const;
private:


	std::string m_szTileSetID;
	int m_nTotalLayers = 0;
	

	// the map size in number of tiles
	int m_nMapWidth = 0;
	int m_nMapHeight = 0;
	
	// the tile size in pixles
	int m_nTileWidth = 0;
	int m_nTileHeight = 0;

	int m_nTileRows = 0;
	int m_nTileColumns = 0;

	int	m_nStartingX;
	int	m_nStartingY;
	int m_nEndingX;
	int m_nEndingY;

	SGD::HTexture m_hTileSet = SGD::INVALID_HANDLE;
	

	std::vector<Layer*> m_vLayerVector;
	std::vector<int>    m_ndelete;
	std::vector<int>	m_ndeletelayer;

};